package com.vogue.supplymall.shop.domain.dao.impl;

import com.vogue.supplymall.shop.domain.dao.ProductImgDao;
import com.vogue.supplymall.shop.domain.mapper.ProductImgMapper;
import com.vogue.supplymall.shop.domain.model.ProductImg;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Aouthor: zhangliang
 * @Date: Create in 2017-12-07
 */
@Repository("productImgDao")
public class ProductImgDaoImpl extends BaseDaoImpl<ProductImg, Long> implements ProductImgDao {
    @Resource
    private ProductImgMapper productImgMapper;

    @Override
    public List<ProductImg> findById(Long id) {
        return productImgMapper.findByWhr(" where productid = " + id, ProductImg.class);
    }

	@Override
	public List<ProductImg> findProductImgBySP(Long syscodeId, Long productId) {
		return productImgMapper.findProductImgBySP(syscodeId, productId);
	}

	@Override
	public int delProductImgBySP(Long syscodeId, Long productId) {
		String sql="delete from product_img where syscodeid="+syscodeId+" and productId="+productId;
		int cnt=this.delete(sql);
		
		return cnt;
	}
    
}
